package com.fpt.mockproject.j21.absd.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NaturalId;

@Entity
@Table(name = "TYPE_OF_BUSINESS")
@DynamicUpdate(value = true)
public class TypeOfBusiness {
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "TypeOfBusinessID", nullable = false, updatable = false, unique = true)
	private Long typeOfBusinessID;
	
	@NaturalId
	@Column(name = "TypeOfBusinessName", nullable = false, unique = true)
	private String typeOfBusinessName;
	
	@Column(name = "SicCode", nullable = false, unique = true)
	private Integer SicCode;
	
	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "typeOfBusiness")
	private Set<Address> addresses = new HashSet<>(0);
	
	public Long getTypeOfBusinessID() {
		return typeOfBusinessID;
	}
	public void setTypeOfBusinessID(Long typeOfBusinessID) {
		this.typeOfBusinessID = typeOfBusinessID;
	}
	public String getTypeOfBusinessName() {
		return typeOfBusinessName;
	}
	public void setTypeOfBusinessName(String typeOfBusinessName) {
		this.typeOfBusinessName = typeOfBusinessName;
	}
	public Integer getSicCode() {
		return SicCode;
	}
	public void setSicCode(Integer sicCode) {
		SicCode = sicCode;
	}
}
